/**
 * @program: LeetCode
 * @description: LeetCode : 剑指 Offer II 069. 山峰数组的顶部
 * @author: WXY
 * @create: 2023-01-09 10:08
 * @Version 1.0
 **/
public class offer_twentythree2_peakIndexInMountainArray {
    public static int peakIndexInMountainArray(int[] arr) {
        int left = 0;
        int right = arr.length - 1;
        while (left < right) {
            int mid = left + (right - left) / 2;
            if (arr[mid] > arr[mid - 1]) {
                left = mid + 1;
            } else {
                right = mid;
            }
        }
        return left - 1;
    }

    public static void main(String[] args) {

    }
}
